<?php
namespace app\admin\model;

use think\Model;
use think\model\concern\SoftDelete;


class Blog extends Model 
{

    use SoftDelete;
    protected $deleteTime = 'delete_time';

 
    public static function show($list_rows = '10'){

    	$list = Blog::order('id', 'desc')
            ->paginate($list_rows);
            return $list;
    }

    public static function status($id,$status){

        $user = Blog::get($id);
        $user->status     = $status;
        $user->save();
 

    }
    public static function edit($id,$title,$content){

        $user = Blog::get($id);
        $user->title     = $title;
        $user->content     = $content;
        $user->save();
 

    }
    public static function del($id){
  
 
            // 软删除
            Blog::destroy($id); 



    }
    public static function view($id = '1'){

        // 取出主键为1的数据
		$view = Blog::get($id);
            return $view;
    }

    public static function add($title,$content){

 

            $user             = new Blog;
            $user->title      = $title;
            $user->content    = $content;
            $user->save();


   
        
            return  $user->id;


        


    }

}